<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="王佳佳">
    <title>遮罩层</title>
    <style>
        *
        {
            box-sizing: border-box;
        }
        body
        {
            margin: 0;
            width: 100%;
            height: 1000px;
            background-color: lightgray;
        }
        .top
        {
            position: relative;
            /* border: 4px solid lightgray; */
            width: 460px;
            height: 600px;
            margin: 10px auto;
            text-align: center;
            padding-top: 7px;
            /* padding-left:  */
            background-color: white; 
        }
        .top img
        {
            width: 440px;
            height: 440px;
        }
        .top span
        {
            display: inline-block;
            margin-top: 5px;
            margin-left: 5px;
            margin-right: 5px;
        }
        .top-ceng
        {
            width: 100%;
            height: 100%;
            position: absolute;
            /* background-color: rgba(0, 0, 0, 0.7); */
            border: 4px solid salmon;
            margin-top: -545px;
            display: none;
        }
        .bottom
        {
            width: 460px;
            height: 230px;
            margin: auto;
            display: flex;
            justify-content: space-around;
            align-items: center;
            background-color: white;
        }
        .bottom>div
        {
            width: 210px;
            height: 210px;
            position: relative;
            overflow: hidden;  
        }
        .bottom>div img
        {
            width: 100%;
            height: 100%;
        }
        .bottom-ceng
        {
            width: 100%;
            height: 100%;
            position: absolute;
            background-color: rgba(0, 0, 0, 0.5);
            /* margin-left: -210px; */
            margin-top: -215px;
            /* display: none;  */
            opacity: 0;
        }
        .bottom-text
        {
            width: 100%;
            height: 100%;
            position: absolute;
            padding-left: 8px;
            padding-right: 8px;
            margin-left: -210px;
            margin-top: -215px;
            color: white;
            /* display: none;    */
            /* border: 1px solid black; */
        }
    </style>
</head>
<body>
    <script src="./jquery.js"></script>
    <section class="top">
        <img src="./1.jpg" alt="">
        <span>【金熹】设计上运用了多片层叠设计，形成立体倒放的花苞视觉效果，创意独特。浓烈的印花
                明快的色彩勾勒出美妙的夏日异国情调，优质雪纺面料让小衫更显质感穿着凉爽透气，做工相当考究
        </span>
            <section class="top-ceng"></section>
    </section>
    <section class="bottom">
        <div>
            <a href=""><img src="./2.jpg" alt=""></a>
            <section class="bottom-ceng"></section>
            <section class="bottom-text">
                <p>special品牌旗舰店</p>
                <span>最具浪漫色彩的欧洲经典设计，给你带来专属的魅力</span>
            </section>
        </div>
        <div>
            <a href=""><img src="./3.jpg" alt=""></a>
            <section class="bottom-ceng"></section>
            <section class="bottom-text">
                <p>sophy橡菲旗舰店</p>
                <span>新款韩版微笑上衣圆领女短袖修身T恤</span>
            </section>
        </div>
    </section>
</body>
</html>
<script>
    //边框出现和隐藏
    window.onload = function()
    {
        $('.top').hover(
            function()
            {
                //清除队列 离开后仅执行一次
                $('.top-ceng').stop().fadeTo(800,1);
            },
            function()
            {
                //清除队列 离开后仅执行一次  避免多次执行
                $('.top-ceng').stop().fadeTo(800,0);
            }
        );
        //层出现、文字移动
        $('.bottom div').each(function()
        {
            $(this).hover(
                function()
                {
                    $($(this).children('.bottom-ceng')).stop().fadeTo(500,1);
                    $($(this).children('.bottom-text')).stop().animate({marginLeft:0},500);
                },
                function()
                {
                    $($(this).children('.bottom-ceng')).stop().fadeTo(500,0);
                    $($(this).children('.bottom-text')).stop().animate({marginLeft:-210},500);
                }
            )
        })
    }
</script>